<?php


namespace app\zhongcan\controller;


use app\zhongcan\model\ChartModel;
use cmf\controller\AdminBaseController;
use think\facade\Db;


class ChartController extends AdminBaseController
{
    public function index()
    {
        echo "<a href='add'>1</a>";
    }

    public function add()
    {

        return $this->fetch();
    }
    public function addPost()
    {
        $image = $_POST['image'];
        $image = cmf_get_image_url($image);
        $res = ChartModel::create([
            'url'=>'#',
            'image'=>$image
        ]);
        if($res){
            return $this->success('添加成功');
        }else{
            return $this->error('添加失败');
    }
    }
}